package com.njit.mailm.core.service.impl;

import com.njit.mailm.core.bean.Draft;
import com.njit.mailm.core.bean.Email;
import com.njit.mailm.core.bean.Page;
import com.njit.mailm.core.dao.DraftDao;
import com.njit.mailm.core.service.DraftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Administrator on 2016/4/21.
 */
@Transactional
@Service
public class DraftServiceImpl  implements DraftService{
    @Autowired
    private DraftDao draftDao;
    public Draft getDraftById(String id) {
        return draftDao.getDraftById(id);
    }

    public void updateDraft(Draft draft) {
        draftDao.updateDraft(draft);
    }

    public void insertDraft(Draft draft) {
        draftDao.insertDraft(draft);
    }

    public int getDraftTotal(Email email) {
        return draftDao.getDraftTotal(email.getId());
    }

    public List<Draft> pageListDraft(Page p, Email email) {
        return draftDao.pageListDraft(p,email);
    }
}
